import request from '@/router/axios';

export const selectPageList = (current, size, params) => {
  return request({
    url: '/api/data-quality/manageRule/selectPageList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const generateCode = (type, themeId) => {
  return request({
    url: '/api/data-quality/manageRule/generateCode',
    method: 'get',
    params: {
      type,
      themeId,
    }
  })
}

export const saveRule = (row) => {
  return request({
    url: '/api/data-quality/manageRule/saveRule',
    method: 'post',
    data: row
  })
}

export const saveRuleAndTemplate = (row) => {
  return request({
    url: '/api/data-quality/manageRule/saveRuleAndTemplate',
    method: 'post',
    data: row
  })
}

export const updateRule = (row) => {
  return request({
    url: '/api/data-quality/manageRule/updateRule',
    method: 'post',
    data: row
  })
}

export const deleteRules = (ids) => {
  return request({
    url: '/api/data-quality/manageRule/deleteRules',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const deleteRule = (id) => {
  return request({
    url: '/api/data-quality/manageRule/deleteRule',
    method: 'post',
    params: {
      id,
    }
  })
}

export const getRules = (ids) => {
  return request({
    url: '/api/data-quality/manageRule/getRules',
    method: 'get',
    params: {
      ids,
    }
  })
}

export const getRuleDetail = (id) => {
  return request({
    url: '/api/data-quality/manageRule/getRuleDetail',
    method: 'get',
    params: {
      id,
    }
  })
}

